import { parse } from 'url';
import { InitInfoItem } from './data.d';

function getCourierCompanyInit(
  req: { url: any },
  res: {
    json: (
      arg0: { body: InitInfoItem },
    ) => void;
  },
  u: any,
) {
  let new_url = u;
  if (!new_url || Object.prototype.toString.call(new_url) !== '[object String]') {
    new_url = req.url;
  }

  const dataSource: InitInfoItem = {
    typeList: [
      { mCode: 13401, codeName: '小区' },
      { mCode: 13402, codeName: '学校' },
    ],
    allOrgs: [
      { id: 793, name: '社区事业部' },
      { id: 1, name: '中科富创' },
    ],
    tariffDict: [
      { name: '基础套餐' },
      { name: '五元套餐' },
    ],
    propertyList: [
      { id: 793, name: '宏源大厦物业公司' },
      { id: 1, name: '酒仙桥物业公司' },
    ],
    passwordType: [
      '6位字母和数字',
      '8位纯数字',
    ],
  };

  const result = {
    code: 0,
    body: dataSource,
  };

  return res.json(result);
}

export default {
  'GET /garden/ext-info': getCourierCompanyInit,
};
